package com.itheima.web.controller;

import com.itheima.util.ResultInfo;
import com.itheima.web.manager.UserManagementManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class UserManagementController {
    @Autowired
    private UserManagementManager userManagementManager;

    //用户列表
    @GetMapping("/employee/find")
    public ResultInfo findAll(
            String name,
            @RequestParam(value = "page", defaultValue = "1") Integer pageNum,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
    ){
        //1.调用manager
       return userManagementManager.findAll(pageNum,pageSize,name);
    }
    //搜索用户地理位置
    @GetMapping("/userLocation")
    public Map findMap(String id){
        //1.调用manager
        Long userId = Long.valueOf(id);
        System.out.println(userId);
       return userManagementManager.findMap(userId);

    }
}
